package com.tsunami.authority.entity.auth;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tsunami.authority.enums.auth.Sex;
import com.tsunami.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author lx
 * @since 2021-09-23
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@TableName("tnm_auth_user")
@ApiModel(value="User", description="用户")
public class User extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "租户号")
    @TableField(value = "tenant_id")
    private Long tenantId;

    @ApiModelProperty(value = "账号")
    @TableField(value = "account")
    private String account;

    @ApiModelProperty(value = "姓名")
    @TableField(value = "name")
    private String name;

    @ApiModelProperty(value = "组织ID")
    @TableField(value = "org_id")
    private Long orgId;

    @ApiModelProperty(value = "岗位ID")
    @TableField(value = "station_id")
    private Long stationId;

    @ApiModelProperty(value = "邮箱")
    @TableField(value = "email")
    private String email;

    @ApiModelProperty(value = "手机号")
    @TableField(value = "mobile")
    private String mobile;

    @ApiModelProperty(value = "性别")
    @TableField(value = "sex")
    private Sex sex;

    @ApiModelProperty(value = "启用状态")
    @TableField(value = "status")
    private String status;

    @ApiModelProperty(value = "头像")
    @TableField(value = "avatar")
    private String avatar;

    @ApiModelProperty(value = "工作描述")
    @TableField(value = "work_describe")
    private String workDescribe;

    @ApiModelProperty(value = "最后一次输错密码时间")
    @TableField(value = "password_error_last_time")
    private LocalDateTime passwordErrorLastTime;

    @ApiModelProperty(value = "密码错误次数")
    @TableField(value = "password_error_num")
    private Integer passwordErrorNum;

    @ApiModelProperty(value = "密码过期时间")
    @TableField(value = "password_expire_time")
    private LocalDateTime passwordExpireTime;

    @ApiModelProperty(value = "账号过期时间")
    @TableField(value = "account_expire_time")
    private LocalDateTime accountExpireTime;

    @ApiModelProperty(value = "密码")
    @TableField(value = "password")
    private String password;

    @ApiModelProperty(value = "最后登录时间")
    @TableField(value = "last_login_time")
    private LocalDateTime lastLoginTime;

    @ApiModelProperty(value = "用户类型 系统用户00，注册用户01，会员用户02")
    @TableField(value = "type")
    private String type;

    @Builder
    public User(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime,
                String account, String name, Long orgId, Long stationId, String email,
                String mobile, Sex sex, String status, String avatar, String workDescribe, LocalDateTime passwordErrorLastTime,
                Integer passwordErrorNum, LocalDateTime passwordExpireTime,LocalDateTime accountExpireTime, String password, LocalDateTime lastLoginTime,String type) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.account = account;
        this.name = name;
        this.orgId = orgId;
        this.stationId = stationId;
        this.email = email;
        this.mobile = mobile;
        this.sex = sex;
        this.status = status;
        this.avatar = avatar;
        this.workDescribe = workDescribe;
        this.passwordErrorLastTime = passwordErrorLastTime;
        this.passwordErrorNum = passwordErrorNum;
        this.passwordExpireTime = passwordExpireTime;
        this.accountExpireTime = accountExpireTime;
        this.password = password;
        this.lastLoginTime = lastLoginTime;
        this.type = type;
    }

}
